import request from "@/utils/request";
import Wyrequest from "@/utils/wyrequest";

// - 轮播的数据：https://m.you.163.com/topic/v1/know/navWap.json
// - 瀑布流的分页数据：https://m.you.163.com/topic/v1/find/recAuto.json?page=2&size=2

// 接口
export interface NavModel {
    id: number,
    picUrl: string,
    mainTitle: string,
    viceTitle: string,
    columnUrl: string,
    onlineType: boolean,
    vaildStartTime: number,
    vaildEndTime: number,
    rank: number,
}

export interface BannerModel {
    checkNavType: boolean,
    navList: NavModel[],
    delNavId: null | number
}

interface IDObjectModel {
    id: string | number,

    [x: string]: any
}

export interface ObjectModel {
    [y: string]: any
}

interface PostModel {
    hasMore: boolean,
    result: {
        look: ObjectModel,
        topics: ObjectModel,
    }[],
    extra: null | any
}

// 请求功能函数
export default {

    /* 轮播数据 */
    Banner() {
        return Wyrequest.get<any, BannerModel>("/topic/v1/know/navWap.json");
    },

    /*瀑布流的分页数据*/
    PostDec(data: { page: number, size: number }) {
        // return Wyrequest.get<any>("/topic/v1/find/recAuto.json?page=1&size=2")
        return Wyrequest.get<any, PostModel>("/topic/v1/find/recAuto.json", {params: data});
    }
}